# -*- coding: utf-8 -*-

from odoo import http
from odoo.http import request


class Registration(http.Controller):

    # http://127.0.0.1:8069/visiting_registration/visitor?id=() 访问该网页
    @http.route('/visiting_registration/visitor', type='http', auth='none')
    def visitor_uid(self, id):
        record = request.env['visiting.registration'].sudo().browse(int(id))
        return http.request.render('visiting_registration.report_receipt_template', {'visiting_list': record})

    @http.route('/visiting_registration/visitor/<model("visiting.registration"):registration>', type='http',
                auth='none')
    def visitor_uid_in_path(self, registration):
        return self.visitor_uid(registration.apple_uid)
